﻿using System.Collections.Generic;
using System.Web.Mvc;
using SuperStar.Models;
using System;

namespace SuperStar.Controllers
{
    public class ProductController : Controller
    {
        //
        // GET: /Product/

        private readonly ProductModels _productModel = new ProductModels();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Detail(int id)
        {
            var model = _productModel.GetProductDetail(id);
            // Debugger
            var debugger = new Dictionary<String, String>
                               {
                                   {"0", "Bình thường"}, 
                                   {"1a", "TH1a - XXXXXXXXXX"}, 
                                   {"1b", "TH1b - YYYYYYYYYY"}
                               };
            if (Session["product_debugger"] == null)
            {
                Session.Add("product_debugger", "0");
            }
            if (Request.Params["product_debugger"] != null)
            {
                Session["product_debugger"] = Request.Params["product_debugger"];
            }
            ViewData["debugger"] = debugger;
            return View(model);
        }
    }
}
